# %%
# 导入库
import os
import matplotlib.pyplot as plt
import pandas as pd
from func_1 import *
from func_2 import *
# 初始化
dic, okList = initialize()
# %%
figureSet = []
start = 0
end = 20
g = 5  # group
for i in range(start, end):
    n = okList[i]
    title = str(okList[(i // g)*g: (i // g)*g + g]) + '站点'
    figureSet.append(get_pfs_Data(n))
    figure(figureSet[i-start], figureNum=i//g, title=title,
           xlabel='时间/月', ylabel='月平均风速/(m·s^(-1))',
           save=True, filename=title, figsize=(40, 20),
           xfont=60, yfont=60, tfont=60
           )

# %%
month = [0] * 13
speed = {}
for i in range(start, end):
    li = figureSet[i - start]['annotate']
    for j in li:
        m = j[0] % 12
        s = j[1]
        if m == 0 :
            m = 12
        month[m] = month[m] + 1
        try:
            speed[s] = speed[s] + 1
        except KeyError:
            speed[s] = 1